/**
 * Obsolete.
 * Look @ Bind.js
 * */

function Form() {
    this.model = null;
    this.components = new Array();

    return this;
}

//-------------------------------------------------------------------------------------------------

Form.prototype.setModel = function(model) {
    this.model = model;

    var modelObject = this.model.getObject();
    for (var i = 0; i < this.components.length; i++) {
        if (modelObject.hasOwnProperty(this.components[i].id)) {
            this.components[i].setValue(modelObject[this.components[i].id]);
        }
    }
};

//-------------------------------------------------------------------------------------------------

Form.prototype.addComponent = function(component) {
    this.components.push(component);
};

Form.prototype.getModel = function() {
    var modelObject = this.model.getObject();

    for (var i = 0; i < this.components.length; i++) {
        if (modelObject.hasOwnProperty(this.components[i].id)) {
            modelObject[this.components[i].id] = this.components[i].getValue();
        }
    }
    this.model.setObject(modelObject);

    return this.model;
};